import Vue from 'vue'
import App from './App.vue'
import axios from 'axios';
import 'animate.css';
import VueRouter from 'vue-router';


Vue.use(VueRouter)
import MyHome from './components/MyHome'
import MyNews from './components/MyNews'
let router = new VueRouter({
    mode:"hash",
    routes:[{
        name:"home",
        path:"/home",
        component:MyHome
    },
    {
      name:"news",
      path:"/news",
      component:MyNews
  }]
})

// 适配器 
// axios拦截器 
// 请求拦截器 
axios.interceptors.request.use(function(config){
  console.log("请求拦截器",config);
  config['headers']['Authorization'] = "Bearer "+localStorage.getItem("token");
  return config;
})
// 返还拦截器
axios.interceptors.response.use((res)=>{
  console.log("返还拦截器",res);
  return res
})
Vue.config.productionTip = false
Vue.prototype.$http = axios;

new Vue({
  router,
  render: h => h(App),
}).$mount('#app')


// 1.复习 2. 购物车 改成 vue-cli 3.ele么样式